package com.inspur.demo.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.MessageFormat;

@RestController
@RefreshScope
public class ConfigClientController {

    @Value("${env:-}")
    private String env;


    @Value("${username:-}")
    private String userName;


    @Value("${password:-}")
    private String password;

    @GetMapping("/config/get")
    public String getMessage() {
        return MessageFormat.format("{0}:{1}-{2}", this.env, this.userName, this.password);
    }

}
